package display 
{
	import flash.display.MovieClip;
	import flash.text.AntiAliasType;
	import flash.text.GridFitType;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFieldType;
	import flash.text.TextFormat;
	import utils.Fonts;
	
	/**
	 * ...
	 * @author Henrik Riise Hansen
	 */
	
	public class DisplayTextField extends MovieClip 
	{
		private var fontType:String;
		private var format:TextFormat;
		private var textColor:uint;
		
		public var label:TextField;
		
		public function DisplayTextField(ft:String, txtColor:uint,fontStyle:String=null) 
		{
			fontType = ft;
			
			if (fontStyle)
			{
				fontType += fontStyle;
			}
			
			textColor = txtColor;
			
			build();
		}
		
		private function build():void
		{
			format = new TextFormat;
			
			switch(fontType)
			{
				case 'verdana':
				format = Fonts.verdana;
				createTextField();
				break;
				
				case 'verdanaBold':
				format = Fonts.verdanaBold;
				createTextField();
				break;
			}
		}
		
		private function createTextField():void
		{
			label        = new TextField();
			
		    label.autoSize              = TextFieldAutoSize.LEFT;
			label.antiAliasType         = AntiAliasType.ADVANCED;
			label.selectable            = false;
			label.focusRect             = true;
			label.defaultTextFormat     = format;
			label.textColor             = textColor;
			label.embedFonts            = true;
			label.text                  = "Test";
			
			addChild(label);
		}
	}
}